home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / Sample Code / Sample Editors⁄Viewers / Picture Viewer / Source / PictureViewer.r < prev    next >
Encoding:
Text File  |  1995-12-08  |  10.7 KB  |  450 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2.     File:        PictureViewer.r
  3.  
  4.     Contains:    PictureViewer Resources
  5.  
  6.     Written by:    Sue Dumont
  7.  
  8.     Copyright:    © 1994-95 by Apple Computer, Inc., all rights reserved.
  9. ------------------------------------------------------------------------------*/
  10.  
  11. #define SystemSevenOrBetter 1            // we want the extended types
  12. #define    SystemSevenOrLater    1            // Types.r uses this variable
  13.  
  14. #include "Types.r"
  15. #include "SysTypes.r"
  16. #include "CodeFragmentTypes.r"
  17.  
  18. #ifndef __ODTYPES_R__
  19. #include "ODTypes.r"
  20. #endif
  21.  
  22. #ifndef SOM_Module_OpenDoc_StdDefs_defined
  23. #include "StdDefs.r"
  24. #endif
  25.  
  26. #ifndef _PICTUREVIEWERDEF_
  27. #include "PictureViewerDef.h"
  28. #endif
  29.  
  30. #ifndef _PICTUREVIEWERVERS_
  31. #include "PictureViewerVers.h"
  32. #endif
  33.  
  34. //-------------------------------------------------------------------------------------
  35. // .rsrc resources
  36. //-------------------------------------------------------------------------------------
  37.  
  38. // This file accesses the resources from my .rsrc file (PICTs etc.)
  39. include "PictureViewerOther.rsrc";
  40.  
  41. //-------------------------------------------------------------------------------------
  42. // Finder Version Resources
  43. //-------------------------------------------------------------------------------------
  44.  
  45. // Part's Finder Version Resource
  46.  
  47. resource 'vers' (1) {
  48.     currentMajorVersion,
  49.     finderMinorVersion,
  50.     developmentStage,
  51.     preReleaseNumber,
  52.     verUS,
  53.     shortVersionStr,
  54.     shortVersionStr", © Apple Computer, Inc. 1994-1995"
  55. };
  56.  
  57. resource 'vers' (2) {
  58.     currentMajorVersion,
  59.     finderMinorVersion,
  60.     developmentStage,
  61.     preReleaseNumber,
  62.     verUS,
  63.     shortVersionStr,
  64.     "OpenDoc™ Sample Code"
  65. };
  66.  
  67. //-------------------------------------------------------------------------------------
  68. // Code Fragment Resource
  69. //-------------------------------------------------------------------------------------
  70.  
  71. resource 'cfrg' (0) {
  72.     {    /* [1] */
  73. #ifdef _68KBUILD_
  74.         kMotorola,
  75. #else
  76.         kPowerPC,
  77. #endif
  78.         kFullLib,
  79.         currentVersion,
  80.         compatibleVersion,
  81.         kDefaultStackSize,
  82.         kNoAppSubFolder,
  83.         kIsLib,
  84.         kOnDiskFlat,
  85.         kZeroOffset,
  86.         kWholeFork,
  87.         kPictureViewerID,        /* this must be the class ID */
  88.         /* [2] */
  89. #ifdef _68KBUILD_
  90.         kMotorola,
  91. #else
  92.         kPowerPC,
  93. #endif
  94.         kFullLib,
  95.         currentVersion,
  96.         compatibleVersion,
  97.         kDefaultStackSize,
  98.         kNoAppSubFolder,
  99.         kIsLib,
  100.         kOnDiskFlat,
  101.         kZeroOffset,
  102.         kWholeFork,
  103.         kPartClassName        /* this must be the part class name */
  104.     }
  105. };
  106.  
  107.  
  108. //-------------------------------------------------------------------------------------
  109. // NMAP Resources
  110. //-------------------------------------------------------------------------------------
  111.  
  112. // Map a part's class id (module::classname)
  113. // to the part editor's name
  114. //
  115. resource kODNameMappings (kEditorUserStringMapId, "Class ID->Editor Name") {
  116.     kODEditorUserString,
  117.     {    /* array Types: 1 elements */
  118.         /* [1] */
  119.         kPictureViewerID,
  120.         kODIsINTLText
  121.         {
  122.             smRoman,
  123.             langEnglish,
  124.             kPictureViewerEditorString
  125.         }
  126.     }
  127. };
  128.  
  129.  
  130. // Map a part's class id (module::classname) to
  131. // the data/file OSTypes the part supports.
  132. //
  133. resource kODNameMappings (kPlatformEditorKindMapId, "Class ID->MacOSType") {
  134.     kODEditorPlatformKind,
  135.     {    /* array KeyList: 1 elements */
  136.         /* [1] */
  137.         kPictureViewerID,
  138.         kODIsPltfmTypeSpac {
  139.             /* array PltfmTypeSpacList: 2 elements */
  140.             {
  141.                 /* [1] */
  142.                 kODPlatformFileType, 
  143.                 kPictureDataType,
  144.                 smRoman, 
  145.                 langEnglish, 
  146.                 kPictureFileKindUserString,
  147.                 kODCategoryDrawing,
  148.                 /* [2] */
  149.                 kODPlatformDataType, 
  150.                 kPictureDataType,
  151.                 smRoman, 
  152.                 langEnglish, 
  153.                 kPictureDataKindUserString,
  154.                 kODCategoryDrawing
  155.             }
  156.         }
  157.     }
  158. };
  159.  
  160.  
  161. // Let OpenDoc know that this part is only a viewer. When data
  162. // is bound to a part editor/viewer, OpenDoc will bind to an
  163. // editor over a viewer.
  164. //
  165. resource kODNameMappings (kViewerMapId) {
  166.     kODViewer,
  167.     {    /* array: 1 elements */
  168.         kPictureViewerID,
  169.         kODIsAnISOString {
  170.             kODSimpleViewer
  171.         }
  172.     }
  173. };
  174.  
  175.  
  176. //-------------------------------------------------------------------------------------
  177. // String List Resources
  178. //-------------------------------------------------------------------------------------
  179.  
  180. resource 'STR#' (kMenuStringResID, "Menu Items strings") {
  181.     {    /* array StringArray: 1 element */
  182.         /* [1] */
  183.         "About PictureViewer…",
  184.         /* [2] */
  185.         "Display",
  186.         /* [3] */
  187.         "Crop to frame",
  188.         /* [4] */
  189.         "Scale to frame"
  190.     }
  191. };
  192.  
  193. resource 'STR#' (kErrorStringResID, "Error strings") {
  194.     {    /* array StringArray: 4 elements */
  195.         /* [1] */
  196.         "“PictureViewer” was unable to completely"
  197.         " initialize its internal structures.",
  198.         /* [2] */
  199.         "“PictureViewer” was unable to open the d"
  200.         "ocument due to unforseen circumstances.",
  201.         /* [3] */
  202.         "“PictureViewer” was unable to open a par"
  203.         "t window due to unforseen circumstances.",
  204.         /* [4] */
  205.         "“PictureViewer” has been asked to remove"
  206.         " a frame that does not belong to it, or "
  207.         "an error occurred while removing the fra"
  208.         "me from internal storage.",
  209.         /* [5] */
  210.         "A window that “PictureViewer” created ha"
  211.         "s been deleted without its knowledge. Th"
  212.         "is may generate a fatal error in the nea"
  213.         "r future. Please close the document imme"
  214.         "diately to prevent data loss.",
  215.         /* [6] */
  216.         "“PictureViewer” encountered a fatal erro"
  217.         "r while trying to save. Try saving again"
  218.         " or closing the document."
  219.     }
  220. };
  221.  
  222. //-------------------------------------------------------------------------------------
  223. // Finder Related Resources
  224. //-------------------------------------------------------------------------------------
  225.  
  226. // Kind resources affect the text Finder displays in the
  227. // "kind" column and file info dialog. This feature was
  228. // introduced as part of Macintosh Easy Open.
  229. //
  230. resource 'kind' (kBaseResourceID+1) {
  231.     kPictureViewerViewerOSType,
  232.     0, /* region = USA */
  233.     {
  234.         'shlb', "OpenDoc™ viewer"
  235.     }
  236. };
  237.     
  238. resource 'kind' (kBaseResourceID+2) {
  239.     kODShellSignature,
  240.     0, /* region = USA */
  241.     {
  242.         kPictureViewerDocumentOSType,   "PictureViewer 1.0 document",
  243.         kPictureViewerStationeryOSType, "PictureViewer 1.0 stationery"
  244.     }
  245. };
  246.  
  247. // The -16397 string will be displayed by Finder when a user
  248. // tries to open the editor shared library. The string should
  249. // give the user a little detail about the part's capabilities
  250. // and enough information to install the part in the correct location.
  251. //
  252. resource 'STR ' (-16397, purgeable) {
  253.     "OpenDoc™ viewer\n\n“PictueViewer” demonstrates the functionality of a bas"
  254.     "ic viewer. To work properly, it should be placed in the Editors folder."
  255. };
  256.  
  257. //-------------------------------------------------------------------------------------
  258. // Dialog Resources
  259. //-------------------------------------------------------------------------------------
  260.  
  261. resource 'DLOG' (kAboutBoxID, "PictureViewer About Box") {
  262.     {0, 0, 250, 350},
  263.     dBoxProc,
  264.     invisible,
  265.     goAway,
  266.     0x0,
  267.     kAboutBoxID,
  268.     "",
  269.     alertPositionMainScreen
  270. };
  271.  
  272. resource 'DITL' (kAboutBoxID) {
  273.     {    /* array DITLarray: 8 elements */
  274.         /* [1] */
  275.         {222, 270, 242, 338}, Button { enabled, "OK" },
  276.         /* [2] */
  277.         {24, 25, 56, 57}, Picture { disabled, kViewerIcons },
  278.         /* [3] */
  279.         {13, 68, 237, 69}, Button { disabled, "" },
  280.         /* [4] */
  281.         {64, 13, 65, 337}, Button { disabled, "" },
  282.         /* [5] */
  283.         {46, 76, 62, 172}, StaticText { disabled, "PictureViewer" },
  284.         /* [6] */
  285.         {76, 76, 106, 304}, StaticText { disabled,
  286.             "PictureViewer is a sample part viewer th"
  287.             "at displays Macintosh™ PICT data.xxxxxxx"},
  288.         /* [7] */
  289.         {116, 76, 144, 304}, StaticText { disabled,
  290.             "Written by Sue Dumont, with support from"
  291.             " the OpenDoc™ Engineering team." },
  292.         /* [8] */
  293.         {160, 76, 188, 300}, StaticText { disabled,
  294.             "Copyright© 1994,1995 by Apple Computer, "
  295.             "Inc. All Rights Reserved." },
  296.         /* [9] */
  297.         {51, 272, 64, 340}, StaticText { disabled,
  298.             "Version "shortVersionStr }
  299.     }
  300. };
  301.  
  302. resource 'dctb' (kAboutBoxID) {
  303.     /* dialog background fill color */
  304.     {    /* array ColorSpec: 5 elements */
  305.         /* [1] */
  306.         wContentColor, 59127, 59127, 59127,
  307.         /* [2] */
  308.         wFrameColor, 0, 0, 0,
  309.         /* [3] */
  310.         wTextColor, 0, 0, 0,
  311.         /* [4] */
  312.         wHiliteColor, 0, 0, 0,
  313.         /* [5] */
  314.         wTitleBarColor, 65535, 65535, 65535
  315.     }
  316. };
  317.  
  318. data 'ictb' (kAboutBoxID) {
  319.     /* dialog control text styling */
  320.     $"0000000000000000002800240028"
  321.     $"004C80070074800700888007009C"
  322.     $"800700B0800700C4000000000000"
  323.     $"000300007FFF7FFF7FFF0001FFFF"
  324.     $"FFFFFFFF00020000000000000003"
  325.     $"FFFFFFFFFFFF0000000000000003"
  326.     $"00007FFF7FFF7FFF0001FFFFFFFF"
  327.     $"FFFF00020000000000000003FFFF"
  328.     $"FFFFFFFF00D80100000E00000000"
  329.     $"0000FFFFFFFFFFFF000000E10000"
  330.     $"0009000000000000FFFFFFFFFFFF"
  331.     $"000000E800000009000000000000"
  332.     $"FFFFFFFFFFFF000000EF00000009"
  333.     $"000000000000FFFFFFFFFFFF0000"
  334.     $"00F600000009000000000000FFFF"
  335.     $"FFFFFFFF00000850616C6174696E"
  336.     $"6F0647656E6576610647656E6576"
  337.     $"610647656E6576610647656E6576"
  338.     $"61"
  339. };
  340.  
  341. resource 'DLOG' (kErrorBoxID, "PictureViewr Error Box") {
  342.     {57, 46, 244, 374},
  343.     dBoxProc,
  344.     invisible,
  345.     goAway,
  346.     0x0,
  347.     kErrorBoxID,
  348.     "",
  349.     alertPositionParentWindowScreen
  350. };
  351.  
  352. resource 'DITL' (kErrorBoxID) {
  353.     {    /* array DITLarray: 5 elements */
  354.         /* [1] */
  355.         {153, 256, 173, 314}, Button { enabled, "OK" },
  356.         /* [2] */
  357.         {153, 185, 173, 243}, Button { enabled, "Cancel" },
  358.         /* [3] */
  359.         {11, 70, 124, 317}, StaticText { disabled,
  360.             "<< Use this for errors in the Editor, su"
  361.             "ch as out of memory, unable to acquire s"
  362.             "ome system resource, etc.>> \nUser errors"
  363.             " use a standard alert appearance. See DI"
  364.             "TL 129.>>" },
  365.         /* [4] */
  366.         {11, 19, 43, 51}, Picture { disabled, kViewerIcons },
  367.         /* [5] */
  368.         {149, 252, 177, 318}, UserItem { disabled }
  369.     }
  370. };
  371.  
  372. //-------------------------------------------------------------------------------------
  373. // Menu and items
  374. //-------------------------------------------------------------------------------------
  375.  
  376. resource 'MENU' (kMenuStringResID) {
  377.     kMenuStringResID,
  378.     textMenuProc,
  379.     allEnabled,
  380.     enabled,
  381.     "Display",
  382.     {    /* array: 2 elements */
  383.         /* [1] */
  384.         "Crop to frame", noIcon, noKey, check, plain,
  385.         /* [2] */
  386.         "Scale to frame", noIcon, noKey, noMark, plain
  387.     }
  388. };
  389.  
  390. //-------------------------------------------------------------------------------------
  391. // Finder Bundle Information
  392. //-------------------------------------------------------------------------------------
  393.  
  394. resource 'BNDL' (kDocumentBundle, "Document BNDL") {
  395.     kODShellSignature,
  396.     0,
  397.     {    /* array TypeArray: 2 elements */
  398.         /* [1] */
  399.         'FREF',
  400.         {    /* array IDArray: 1 element */
  401.             0, kDocumentFREF
  402.         },
  403.         /* [2] */
  404.         'ICN#',
  405.         {    /* array IDArray: 1 element */
  406.             0, kDocumentIcons
  407.         }
  408.     }
  409. };
  410.  
  411. resource 'BNDL' (kViewerBundle, "Viewer BNDL") {
  412.     kPictureViewerViewerOSType,
  413.     0,
  414.     {    /* array TypeArray: 2 elements */
  415.         /* [1] */
  416.         'FREF',
  417.         {    /* array IDArray: 1 elements */
  418.             /* [1] */
  419.             0, kViewerFREF
  420.         },
  421.         /* [2] */
  422.         'ICN#',
  423.         {    /* array IDArray: 1 elements */
  424.             /* [1] */
  425.             0, kViewerIcons
  426.         }
  427.     }
  428. };
  429.  
  430.  
  431. resource 'FREF' (kDocumentFREF) {
  432.     kPictureViewerDocumentOSType,
  433.     0,
  434.     ""
  435. };
  436.  
  437. resource 'FREF' (kViewerFREF) {
  438.     'shlb',
  439.     0,
  440.     ""
  441. };
  442.  
  443. data kODShellSignature (0, "Owner resource") {
  444.     $"00"
  445. };
  446.  
  447. data kPictureViewerViewerOSType (0, "Owner resource") {
  448.     $"00"
  449. };
  450.